package com.code2roc.jarmanage.db;

import com.code2roc.jarmanage.model.DeviceManageDO;
import com.code2roc.jarmanage.util.CommonUtil;
import com.code2roc.jarmanage.util.DataBaseUtil;

import java.util.List;

public class DeviceManageDB {
    public static void insert(DeviceManageDO entity) {
        entity.setDeviceID(CommonUtil.getNewGuid());
        DataBaseUtil.insert("DeviceManage", entity);
    }

    public static void delete(String deviceID) {
        DataBaseUtil.executeSQL("delete from DeviceManage where deviceID='" + deviceID + "'");
    }

    public static void update(DeviceManageDO entity) {
        DataBaseUtil.update("DeviceManage", entity, "deviceID");
    }

    public static DeviceManageDO selectOne(String proxyID) {
        return DataBaseUtil.selectOne(DeviceManageDO.class, "DeviceManage", "deviceID", proxyID);
    }

    public static List<DeviceManageDO> selectList(String where) {
        return DataBaseUtil.selectList(DeviceManageDO.class, "DeviceManage", where);
    }
}
